Skip to content

parse more recent name sections#5

Open
zeldovich wants to merge 1 commit intosecure-foundations:mainfrom
zeldovich:names
Open

parse more recent name sections#5
zeldovich wants to merge 1 commit intosecure-foundations:mainfrom
zeldovich:names

Conversation

@zeldovich
Copy link

This adds support for parsing name sections emitted by recent wasm toolchains, such as clang.

This adds support for parsing name sections emitted by recent wasm
toolchains, such as clang.
@jaybosamiya
Copy link
Member

Thanks Nickolai! The change seems quite reasonable upon a quick read, but when I attempted to test it there are apparently more issues that get hit on modern clang on the few examples I tried.

I'd like to fix up the various issues to allow it to start working again on more modern clang, but in the meanwhile, could you let me know the particular clang/wasi-sdk/... version you're using so that we can at least modernize things up to that point before looking further? It would also make it easier for me to test the changes on this PR so that we can at least get this PR (and #4) in.

Also, given that the rWasm main hasn't been touched in ~4 years, a whole collection of Rust warnings have started to show up. I'll fix those up soon in a separate PR to reduce the noise :)

@zeldovich
Copy link
Author

For this PR, here's a small test case, on Arch Linux:

% cat example.c
void _start(void) {}
% clang --version
clang version 21.1.8
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
% clang --target=wasm32 -nostdlib -o example.wasm example.c
% 

with the current latest version of rWasm, I get:

% cargo run example.wasm
...
Finished reading
The application panicked (crashed).
Message:  not implemented
Location: src/parser.rs:757

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
% 

with the change in this PR, I get:

% cargo run example.wasm
...
Finished reading
Finished parsing
Finished generating
Finished reformatting
Finished
% 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants